import { BrowserWindow } from 'electron'
import { Controller, Inject, IpcHandle,  IpcOn, Window, BaseController  } from '@support/index'
import { SystemService } from './system.service'

@Controller()
export class SystemController extends BaseController {
  constructor(
    private systemService: SystemService
  ) { 
    super()
    // console.log('SystemController', arguments )
  }

  @IpcHandle('get-sys-bars-list')
  getSysBarsList( isMenu = true ){
    return this.systemService.getSysBars( isMenu )
  }

  @IpcHandle('get-sys-bars-subs')
  getSysBarSublist( pluId: number){
    return this.systemService.getSysBarSubs( pluId )
  }

  /*以下为old版本*/
    @IpcHandle('sys-get-menus')
    async handleGetMenus( code: string ){
      return this.systemService.getMenus( code )
    }

    @IpcHandle('sys-get-menusbars')
    async handleGetMenusBars(){
      console.log(this.systemService)
      return this.systemService.getMenusBars()
    }

    @IpcHandle('sys-create-browser-view')
    async handleCreateBrowserView( p: any ){
      return this.systemService.createBrowserView( p )
    }

    @IpcOn('sys-browser-view-destroy')
    handleBrowserViewDestory( id: string ){
      return this.systemService.browserViewDestory( id )
    }

    @IpcHandle('sys-brower-view-active')
    async handleBrowerViewActive( id: string ){
      return this.systemService.browerViewActive( id )
    }

    @IpcHandle('sys-plugin-boot-path')
    async handlePluginAppBootPath( apptag: string ){
      return this.systemService.pluginAppBootPath( apptag )
    }

    @IpcOn('sys-browser-view-resize')
    handleBrowserViewResize( p: any ){
      return this.systemService.handleBrowserViewResize( p )
    }
  /*以上为old版本*/
}